package com.example.swordjava;


public class Test15 {

    public static void main(String[] args) {

        int[] a = {2, 3, 1, 0, 2, 5, 3};

    }

    /**
     * 二进制中1的个数
     */

    public int NumberOf1(int n) {

        int count = 0;
        while (n != 0) {
            count++;
            n = n & n - 1;
        }
        return count;
    }

}
